package com.rhino.security.controller;

import com.rhino.security.service.RefreshJWTTokenService;
import com.rhino.security.vo.JWTTokenVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 刷新jwttoken管理类
 */
@Api(tags = "刷新jwt令牌管理相关接口")
@RestController
@RequestMapping("/token")
public class SecurityTokenController {

    @Autowired
    private RefreshJWTTokenService refreshJWTTokenService;

    /**
     * 刷新jwt token
     *
     * @param refreshToken
     * @return: 新的token信息
     **/
    @GetMapping("/refreshToken")
    public JWTTokenVO refreshToken(String refreshToken) {
        return  refreshJWTTokenService.refreshToken(refreshToken);
    }
}
